/**
 * 分享协议管理
 */
class SharePrase{
    public constructor() {
	}
    private static _instance:SharePrase;

    public static instance():SharePrase{
		if(!SharePrase._instance){
			SharePrase._instance = new SharePrase();
		}
		return SharePrase._instance;
	}

    //请求一条广告语和确定发送广告语成功
    public requestOneAdvertisement(prama)
    {
        let type = prama.type == ShareId.show ? 'show' : prama.type;
        let data = {
            type :  type,
            version: GameConst.version
        }
        // let openid = RoleCache.instance().openid ? RoleCache.instance().openid : '' ;
        HttpManager.instance().sendPost(GameConst.httpUrl + 'warriorother/get_share_info', StringUtil.jsonToHttpPostString(data), (e)=>{
            let data = JSON.parse(e);

            if(data && data.data)
            {
                let Prama = {
                    imgUrl:data.data.imgUrl,
                    title:data.data.title,
                    prama:prama
                }
                WeChatgGameManager.instance().share(Prama);
            }
        })
    }
}

enum ShareId{
	default, // 默认
	ThreeKnife, //三发
    killDragon, //屠龙宝刀
    invite,     //邀请分享
    sign,       //签到
    show,       //游戏结束炫耀
    offline,    //离线收益
    relive,     //复活
    ticket_share, //入场券分享
    experience_weapon, //体验武器
    show_weapon,//展示武器
    Max
}